# 单继承
class Person:
    def __init__(self, name, age):
        self.name = name
        self.age = age

    def eat(self):
        print("吃饭")


class Student(Person):
    def __init__(self, name, age, school):
        super().__init__(name, age)
        self.school = school

    # 重写父类的方法
    def eat(self):
        # 执行父类的方法
        Person.eat(self)
        super().eat()
        print("学生吃饭")


class Teacher(Person):
    # 占位符，类里面即使不写东西，也不会报错，会自动通过
    pass


# 多继承
class Father(object):
    def height(self):
        print("father height is 180cm")


class Mother(object):
    def height(self):
        print("mother height is 170cm")


class Son(Father, Mother):
    pass


student = Student("张三", 18, "清华大学")
teacher = Teacher("李四", 28)

print(student.name)
student.eat()
teacher.eat()

son = Son()
# 先继承谁，则调用谁的方法
son.height()
# 查看继承顺序
print(Son.__mro__)
